//做路由配置
import './index.scss'
import React from 'react';
//使用懒加载配置路由
const Main = React.lazy(() => import("../pages/main"));
const Cart = React.lazy(() => import("../pages/cart"));
const Category = React.lazy(() => import("../pages/category"));
const Ceo = React.lazy(() => import("../pages/ceo"));
const Me = React.lazy(() => import("../pages/me"));
const Item = React.lazy(() => import("../pages/item"));
const SearchCom = React.lazy(() => import("../pages/search"));
const ListCom = React.lazy(() => import("../pages/list"));
const OrderSubmit = React.lazy(() => import('../pages/order/ordersubmit'));
const OrderPay = React.lazy(() => import('../pages/order/orderpay'));
const OrderList = React.lazy(() => import('../pages/order/orderlist'));
const Login = React.lazy(() => import("../pages/login"));
const Page404 = React.lazy(() => import("../pages/page404"));

//配置路由表
const routes = [
    { path: '/', element: <Main />, auth: false, name: "/" },
    { path: '/category', element: <Category />, auth: false, name: "/category" },
    { path: '/cart', element: <Cart />, auth: true, name: "/cart" },
    { path: '/ceo', element: <Ceo />, auth: false, name: "/ceo" },
    { path: '/me', element: <Me />, auth: true, name: "/me" },
    { path: '/item/:id', element: <Item />, auth: false, name: "/item" },
    { path: '/search', element: <SearchCom />, auth: false, name: "/search" },
    { path: '/list/:searchstr', element: <ListCom />, auth: false, name: "/list" },
    { path: '/ordersubmit', element: <OrderSubmit />, auth: true, name: "/ordersubmit" },
    { path: '/orderpay', element: <OrderPay />, auth: true, name: "/orderpay" },
    { path: '/orderlist', element: <OrderList />, auth: true, name: "/orderlist" },
    { path: '/login', element: <Login />, auth: false, name: "/login" },
    { path: '*', element: <Page404 />, auth: false, name: "/page404" },
]
export default routes;
